home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Utilities / GOCR / src / pnm.h < prev    next >
C/C++ Source or Header  |  2000-03-08  |  732b  |  30 lines

  1. // Handle PNM-files  Dez98 JS
  2. // 0,0 = left up
  3. // PNM-formats
  4. // PGM gray ASCII=P2 RAW=P5 dx dy col gray
  5. // PPM RGB  ASCII=P3 RAW=P6 dx dy col RGB
  6. // PBM B/W  ASCII=P1 RAW=P4 dx dy     bitmap
  7.  
  8. #ifndef PNM_H
  9. #define PNM_H 1
  10.  
  11. struct pixmap {
  12.    unsigned char *p;        // pointer of image buffer (pixmap)
  13.    int x;        // xsize
  14.    int y;        // ysize
  15.    int bpp;        // bytes per pixel:  1=gray 3=rgb
  16.  };
  17. typedef struct pixmap pix;
  18.  
  19. void readpgm(char *name,pix *p,int vvv);
  20.  
  21. // write pgm-map to pnm-file
  22. int writepgm(char *nam,pix p);
  23. int writepbm(char *nam,pix p);
  24. int writeppm(char *nam,pix p);        // use lowest 3 bits for farbcoding
  25.  
  26. // ----- count colors ------ create histogram -------
  27. void makehisto(pix p, unsigned col[256], int vvv);
  28.  
  29. #endif
  30.